<?php

// No direct access
 
defined('_JEXEC') or die('Restricted access'); ?>
<script type="text/javascript">
$(document).ready(function() {
	$('#tabs').tabs(); 
	$('#wordsAdminTable').dataTable({
			"oLanguage": {
			"sProcessing": "<?php print($this->rsc->sProcessing);?>...",
			"sLengthMenu": "<?php print($this->rsc->sLengthMenu);?>",
			"sZeroRecords": "<?php print($this->rsc->sZeroRecords);?>",
			"sInfo": "<?php print($this->rsc->sInfo);?>",
			"sInfoEmpty": "<?php print($this->rsc->sInfoEmpty);?>",
			"sSearch": "<?php print($this->rsc->sSearch);?>:",
			"oPaginate": {
				"sFirst":    "<?php print($this->rsc->sFirst);?>",
				"sPrevious": "<?php print($this->rsc->sPrevious);?>",
				"sNext":     "<?php print($this->rsc->sNext);?>",
				"sLast":     "<?php print($this->rsc->sLast);?>"
			},
			"sInfoFiltered": "<?php print($this->rsc->sInfoFiltered);?>"
		}
	} );
	
	$('#langAdminTables').dataTable({
			"oLanguage": {
			"sProcessing": "<?php print($this->rsc->sProcessing);?>...",
			"sLengthMenu": "<?php print($this->rsc->sLengthMenu);?>",
			"sZeroRecords": "<?php print($this->rsc->sZeroRecords);?>",
			"sInfo": "<?php print($this->rsc->sInfo);?>",
			"sInfoEmpty": "<?php print($this->rsc->sInfoEmpty);?>",
			"sSearch": "<?php print($this->rsc->sSearch);?>:",
			"oPaginate": {
				"sFirst":    "<?php print($this->rsc->sFirst);?>",
				"sPrevious": "<?php print($this->rsc->sPrevious);?>",
				"sNext":     "<?php print($this->rsc->sNext);?>",
				"sLast":     "<?php print($this->rsc->sLast);?>"
			},
			"sInfoFiltered": "<?php print($this->rsc->sInfoFiltered);?>"
		}
	} );

	$('#qasAdminTable').dataTable({
		"oLanguage": {
		"sProcessing": "<?php print($this->rsc->sProcessing);?>...",
		"sLengthMenu": "<?php print($this->rsc->sLengthMenu);?>",
		"sZeroRecords": "<?php print($this->rsc->sZeroRecords);?>",
		"sInfo": "<?php print($this->rsc->sInfo);?>",
		"sInfoEmpty": "<?php print($this->rsc->sInfoEmpty);?>",
		"sSearch": "<?php print($this->rsc->sSearch);?>:",
		"oPaginate": {
			"sFirst":    "<?php print($this->rsc->sFirst);?>",
			"sPrevious": "<?php print($this->rsc->sPrevious);?>",
			"sNext":     "<?php print($this->rsc->sNext);?>",
			"sLast":     "<?php print($this->rsc->sLast);?>"
		},
		"sInfoFiltered": "<?php print($this->rsc->sInfoFiltered);?>"
	}
} );
} );
</script>
<h1><?php echo $this->rsc->admin_title; ?></h1>
<br/>
<br/>
<i><?php echo $this->rsc->admin_text; ?></i>
<br/>
<br/>
<p align="right"><a href="index.php?option=com_hizkuntzak">&laquo; <?php print($this->rsc->volver)?></a></p>
<br/>
<div id="tabs" class="ui-tabs ui-widget ui-widget-content ui-corner-all">
 	<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
		<li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1"><?php print($this->rsc->admin_title_words);?></a></li>
		<li class="ui-state-default ui-corner-top"><a href="#tabs-2"><?php print($this->rsc->admin_title_langs);?></a></li>
		<li class="ui-state-default ui-corner-top"><a href="#tabs-3"><?php echo $this->rsc->admin_title_qas; ?></a></li>
	</ul>
	<div id="tabs-1" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
		<br/>
		<a href="index.php?option=com_hizkuntzak&task=createWord" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
			<span class="ui-button-text"><?php echo $this->rsc->main_add_word; ?></span></a>
		<br/>
		<br/>
		<br/>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="wordsAdminTable">
			<thead>
				<tr>
					<th><?php echo($this->rsc->word_word_es);?></th>
					<th><?php echo($this->rsc->word_word_eu);?></th>
					<th><?php echo($this->rsc->active);?></th>
					<th><?php echo($this->rsc->edit);?></th>
				</tr>
			</thead>
			<tbody>
				<?php 
					$i = 0;
					foreach($this->words as $w){
						if ($i==0){
							print('<tr class="odd">');
							$i=1;
						}
						else if($i==1){
							print('<tr class="even">');
							$i=0;
						}
						//print("<td>".$pr->getObjective()."</td>");
						print("<td>".$w->getWordEs()."</td>");
						print("<td>".$w->getWordEu()."</td>");
						if($w->isActive()){
							print("<td>".$this->rsc->word_active."</td>");
						}
						else{
							print("<td>".$this->rsc->word_no_active."</td>");	
						}
						print("<td ><a href='index.php?option=com_hizkuntzak&task=createWord&idWord=".$w->getIdWord()."' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' role='button'> <span class='ui-button-text'>".$this->rsc->edit."</span></a></td>");
						print("</tr>");
					}
				?>
			</tbody>
			<tfoot>
				<tr>
					<th><?php echo($this->rsc->word_word_es);?></th>
					<th><?php echo($this->rsc->word_word_eu);?></th>
					<th><?php echo($this->rsc->active);?></th>
					<th><?php echo($this->rsc->edit);?></th>
				</tr>
			</tfoot>
		</table>
	</div>
	<div id="tabs-2" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
	
		<br/>
		<a href="index.php?option=com_hizkuntzak&task=createLang" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
			<span class="ui-button-text"><?php echo $this->rsc->main_add_lang; ?></span></a>
		<br/>
		<br/>
		<br/>
		<table cellpadding="0" cellspacing="0" border="0" class="display" id="langAdminTables">
			<thead>
				<tr>
					<th>Iso Code</th>
					<th><?php echo($this->rsc->lang_lang_es);?></th>
					<th><?php echo($this->rsc->lang_lang_eu);?></th>
					<th><?php echo($this->rsc->active);?></th>
					<th><?php echo($this->rsc->edit);?></th>
				</tr>
			</thead>
			<tbody>
				<?php 
					$i = 0;
					foreach($this->langs as $l){
						if ($i==0){
							print('<tr class="odd">');
							$i=1;
						}
						else if($i==1){
							print('<tr class="even">');
							$i=0;
						}
						print("<td>".$l->getIsoCode()."</td>");
						print("<td>".$l->getNameEs()."</td>");
						print("<td>".$l->getNameEu()."</td>");
						if($l->isActive()){
							print("<td>".$this->rsc->word_active."</td>");
						}
						else{
							print("<td>".$this->rsc->word_no_active."</td>");	
						}
						print('<td><a href="index.php?option=com_hizkuntzak&task=createLang&hlang='.$l->getIsoCode().'" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button"> <span class="ui-button-text">'.$this->rsc->edit.'</span></a></td>');
						print("</tr>");
					}
				?>
			</tbody>
			<tfoot>
				<tr>
					<th>Iso Code</th>
					<th><?php echo($this->rsc->lang_lang_es);?></th>
					<th><?php echo($this->rsc->lang_lang_eu);?></th>
					<th><?php echo($this->rsc->active);?></th>
					<th><?php echo($this->rsc->edit);?></th>
				</tr>
			</tfoot>
		</table>
	</div>
	<div id="tabs-3" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
		<br/>
		<a href="index.php?option=com_hizkuntzak&task=createQa" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button">
			<span class="ui-button-text"><?php echo $this->rsc->main_add_qa; ?></span></a>
		<br/>
		<br/>
		<br/>
		<table width="100%" cellpadding="0" cellspacing="0" border="0" class="display" id="qasAdminTable">
			<thead>
				<tr>
					<th><?php echo($this->rsc->qa_q_es);?></th>
					<th><?php echo($this->rsc->qa_q_eu);?></th>
					<th><?php echo($this->rsc->qa_a_es);?></th>
					<th><?php echo($this->rsc->qa_a_eu);?></th>
					<th><?php echo($this->rsc->active);?></th>
					<th><?php echo($this->rsc->edit);?></th>
				</tr>
			</thead>
			<tbody>
				<?php 
					$i = 0;
					foreach($this->qas as $qa){
						if ($i==0){
							print('<tr class="odd">');
							$i=1;
						}
						else if($i==1){
							print('<tr class="even">');
							$i=0;
						}
						
						print("<td>".$qa->getQEs()."</td>");
						print("<td>".$qa->getQEu()."</td>");
						print("<td>".$qa->getAEs()."</td>");
						print("<td>".$qa->getAEu()."</td>");
						if($qa->isActive()){
							print("<td>".$this->rsc->word_active."</td>");
						}
						else{
							print("<td>".$this->rsc->word_no_active."</td>");	
						}
						print("<td ><a href='index.php?option=com_hizkuntzak&task=createQa&id=".$qa->getId()."' class='ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only' role='button'> <span class='ui-button-text'>".$this->rsc->edit."</span></a></td>");
						print("</tr>");
					}
				?>
			</tbody>
			<tfoot>
				<tr>
					<th><?php echo($this->rsc->qa_q_es);?></th>
					<th><?php echo($this->rsc->qa_q_eu);?></th>
					<th><?php echo($this->rsc->qa_a_es);?></th>
					<th><?php echo($this->rsc->qa_a_eu);?></th>
					<th><?php echo($this->rsc->active);?></th>
					<th><?php echo($this->rsc->edit);?></th>
				</tr>
			</tfoot>
		</table>
	</div>
</div>

<p align="right"><a href="index.php?option=com_hizkuntzak">&laquo; <?php print($this->rsc->volver)?></a></p>
<br/>
<br/>
